<?php

include("functions.php");

//manage requests with a simple switch statement
if (!$_POST['action']) {
    header("Location: index.html");
} else {
    switch ($_POST['action']) {
        case "update":
            getContent($_POST['chat']);
            break;
        case "insert":
            echo insertMessage($_POST['name'], $_POST['chat'], $_POST['msg']);
            break;
    }
    mysql_close($link);
}